<?php
// 本类由系统自动生成，仅供测试用途
class YuzhiAction extends Action {

	
	//预设  para一般自身的所有以及扩展的zabojingua东西
	//聚合
    private $all=array(
    	'mdmk'=>'Yuzhi',//NB
  		'ttl'=>'阈值',
  		'jn'=>array('tb_part ON f_yuzhi_partid=partid','tb_line ON f_yuzhi_lineid=lineid'),//NB
      //自己的全部+f的显示的东西
  		'para'=>array('yuzhiid'=>'yuzhiID','f_yuzhi_partid'=>'包材','partcode'=>'包材编码','partnm'=>'包材','f_yuzhi_lineid'=>'产线','linenm'=>'产线','yuzhired'=>'红色阈值','yuzhiyellow'=>'黄色阈值','yuzhispeed'=>'产线速度','yuzhitaketime'=>'taketime'),//NB
  		//抛去不是zabojin的属性针对para
      'notself'=>array('partcode','partnm','linenm'),
       ##########modify 添加修改中不需要展示和理会的属性 针对para
      'no_update'=>array('yuzhiid','partcode','partnm','linenm'),
      #####update的时候允许为空的值 针对zabojin刨掉不然显示的update字段后
      'allowempty'=>array('yuzhinm'),

      'hide_fld'=>array('yuzhiid','f_yuzhi_partid','f_yuzhi_lineid'),//NB
      'hide_cdt'=>array('yuzhiid','partnm','linenm'),//NB
  		
    //   'splinedtls'=>array('splinedt_0'=>array('yuzhiid<>0','yuzhiID不为0【废话只是测试】')),
  		// 'odrls'=>array('yuzhinm'),
    //   'splinedt_dflt'=>array('splinedt_0'),
    //   'odr_dflt'=>array('yuzhinm'=>'ASC'),

      'spccdtls'=>array(),//NB
      'odrls'=>array(),//NB
      'spccdt_dflt'=>array(),//NB
      'odr_dflt'=>array(),//NB
      //hide的fld必须有，他们虽然不显示但是必须选择，这样才能在第一次进入query的时候，隐藏属性可以被调用，特别是id和fid
  		'fld_dflt'=>array('yuzhiid','f_yuzhi_partid','partcode','partnm','f_yuzhi_lineid','linenm','yuzhired','yuzhiyellow','yuzhispeed','yuzhitaketime'),//NB
  		'cdt_dflt'=>array(),//NB
  		
  		'lmt_dflt'=>10,//NB
  		
  		'defaultls'=>1,//默认枚举//NB
  		##########view
  		'no_view'=>array('yuzhiid','f_yuzhi_partid','f_yuzhi_lineid'),
	   
      #########删除提醒
      'deleteconfirm'=>'确定要删除此条记录？',
      #####转义
      'transmean'=>array(),//NB
      #####默认值
      'dfltvalue'=>array(),
      ########新增属性
      'linkage'=>array(),//如果linec的变换需要转换成2015_linec 就是2  否则如果是1 非2情况下联动没有值，不允许下拉，3联动不造成下拉有无
      ########这里是谁影响谁，用在AJAX联动 效果极佳
      'impactfactor'=>array(),
      
    );

    //公版
    public function query(){
    	header("Content-Type:text/html; charset=utf-8");
    	$pb=D('PB');
      $pb->query($this->all);
      $this->display('Cmn:query');
  
    }
    
    //公版
    public function view(){
    	header("Content-Type:text/html; charset=utf-8");
    	$pb=D('PB');
    	$pb->view($this->all);
		  $this->display('Cmn:view');
    }
   
   	//公版
   	public function update(){
   		header("Content-Type:text/html; charset=utf-8");
    	$pb=D('PB');$part=D('Part');$yuzhi=D('Yuzhi');
    	$pb->update($this->all);

      $yuzhiid=$_GET['id'];
      if($yuzhiid){
        $arr_yuzhio=$yuzhi->getyuzhiobyyuzhiid($yuzhiid);$yuzhio=$arr_yuzhio['data'];
        $partid=$yuzhio['f_yuzhi_partid'];
        $arr_parto=$part->getpartobypartid($partid);$parto=$arr_parto['data'];
        $this->assign('f_yuzhi_partid_vl',$parto['partnm'].'[已选]');
        $partls=array();array_push($partls,$parto);
        $this->assign('f_yuzhi_partid',$partls);
      }


		  $this->display('update');
   	}

    public function dogetpartlsbykw(){
      header("Content-Type:text/html; charset=utf-8");
      $part=D('Part');
      
      $kw=$_GET['kw'];
      $arr_partls=$part->getpartlsbykw($kw);$partls=$arr_partls['data'];
      $data['partls']=$partls;
      
      $this->ajaxReturn($data,'json');
    }

   	//公版
   	public function doupdate(){
   		header("Content-Type:text/html; charset=utf-8");
   		$pb=D('PB');
   		$arr_pattern=$pb->doupdate($this->all);
   		$data['pattern']=$arr_pattern['data'];

   		$this->ajaxReturn($data,'json');
   	}

   	//公版
   	public function dodelete(){
   		header("Content-Type:text/html; charset=utf-8");
   		$pb=D('PB');
   		$pb->dodelete($this->all);
  		
   		$this->ajaxReturn($data,'json');
   	}

    public function dolinkage(){
      header("Content-Type:text/html; charset=utf-8");
      $nb=D('NB');
      $arr=$nb->dolinkage($this->all);
      
      $data=$arr['data'];
      
      $this->ajaxReturn($data,'json');
    }

}